<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<html>
<head>
<meta charset="UTF-8">
<title>我的账户-领取红包</title>
<jsp:include page="/include/wchat/head.jsp"></jsp:include>

<script src="/v2/wchat/resrc/js/rsa/RSA.min.js" type="text/javascript"></script>
<script src="/v2/wchat/resrc/js/rsa/BigInt.min.js" type="text/javascript"></script>
<script src="/v2/wchat/resrc/js/rsa/Barrett.min.js" type="text/javascript"></script>
<script type="text/javascript">
function encodeData(e, m, r, v){setMaxDigits(130);var key = new RSAKeyPair(e,"",m);return encryptedString(key, r+v);}
</script>

<link type="text/css" rel="stylesheet" href="/v2/wchat/resrc/css/account.css">
</head>

<body>
<div id="header"> 
	<div style="width:100%;text-align: center;line-height: 20px;top:50%;height:20px;margin-top: -10px;position: absolute; "> 完善信息，使用红包 </div>
	<a href="/wchatIndex.do" class="backto">返回</a>
</div>
<div id="wrap">
	<div class="regist">
		<%-- <div class="itip regist-itip"><b class="novice-50"></b></div> 
		<div class="link-touch">
			<ul class="items">
				<li>
					<label class="txt">账号</label>
					<input type="text" id="account" class="input" placeholder="请输入用户名" maxlength="32" onblur="chekUsNamefor()">
				</li>
			</ul>
		</div> --%>
		<div class="link-touch">
			<ul class="items">
				<li>
					<input type="hidden" id="account" class="input" value="${username }">
					<label class="txt">密码</label>
					<input type="password" id="password" class="input" placeholder="请输入密码" maxlength="16" onblur="chekPwdfor()">
				</li>
				<li>
					<label class="txt">确认</label>
					<input type="password" id="rePassword" class="input" placeholder="请确认密码" maxlength="16" onblur="checkPWDui()">
				</li>
			</ul>
			<div class="vtip">密码需 6-16 位，建议使用字母加数字或符号的组合</div>
		</div>
		<div class="link-touch verify-num"> 
			<span class="verify-code">
				<input type="text" id="captcha" class="input" placeholder="请输入验证码" maxlength="4" onblur="chekVerifyCode()" >
			</span> 
			<img id="imgCaptcha" src="I4008lOve893gOfUll983/imageCode.do?pageId=wchatRegister" onclick="return refresh('wchatRegister');" />
		</div>
		<div class="link-touch acc-agree">
    		<input type="checkbox" checked="checked" class="ipt-agree" id="agreement">
			我同意《<a href="/regAgreement.do">注册协议</a>》及《<a href="/getMessageBytypeId.do?typeId=22">投资咨询与管理服务协议</a>》
			<div id="errorMsg" class="vtip errs none">请重新输入账号</div>
		</div>
		<div class="operate-button operate-acc"> <a href="javascript:;" class="btn" onclick="return register1();">下一步</a> 
		</div>
	</div>
</div>



<jsp:include page="/include/wchat/footer.jsp"></jsp:include>

<script src="/v2/wchat/resrc/js/common/registerVerify.js" type="text/javascript"></script>
<script type="text/javascript">
//下一步按钮提交操作
function register1() {
	$('#signSubmit').attr('href','javascript:;');
	var t1 = chekUsNamefor();
	if(! t1) return false;
	var t2 = chekPwdfor();
	if(! t2) return false;
	var t3 = checkPWDui();
	if(! t3) return false;
	var t4 = chekVerifyCode();
	if(! t4) return false;

	if(tagEleTip.agreement.prop('checked')!=true){
		tagEleTip.errorMsg.html("请同意协议").show();
		return;
	}else{
		tagEleTip.errorMsg.html("").show();
	}
	var param = {};
    param["paramMap.pageId"] = "wchatRegister";
    param["paramMap.userName"] = tagEleTip.account.val();
    param["paramMap.password"] = tagEleTip.password.val();
    param["paramMap.confirmPassword"] = tagEleTip.rePassword.val();
    param["paramMap.code"] = tagEleTip.captcha.val();
	var rs = null;
	$(".regist :input").attr("disabled", true);
	//FIXME 暂时就这样简单校验
	$.post("wchatRegisterByRedEnvelopesFir.do",param,function(data){
		if(data.error=='0'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("ID已被注册").show();
			 refresh('wchatRegister');
	    }else if(data.error=='1'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("用户名长度为2-20个字符").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='2'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("用户名不能为空").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='3'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("用户名不能含有特殊字符").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='4'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("用户名不能以下划线开头").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='5'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("密码不能为空").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='6'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("确认密码不能为空").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='7'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("两次输入密码不一致").show();
			 switchCode('wchatRegister');
	    }else if(data.error=='12'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("注册异常").show();
			 switchCode('wchatRegister');
	    }else if(data.refferee=='1'){
			 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("邀请人不存在").show();
			 switchCode('wchatRegister');
	    }else if(data._checkCode=='1'){
	    	 $(".regist :input").removeAttr('disabled');
			 tagEleTip.errorMsg.html("验证码错误").show();
			 switchCode('wchatRegister');
        }else {
        	 window.location.href="wchatRegisterByRedEnvelopesSec.do";
        }
     });
}
</script>


</body>
</html>